package main

import (
	"fmt"
	"goods_srv/appconfig"
	"goods_srv/goods"
	"goods_srv/initialize"
	"goods_srv/internal/handel"
	"goods_srv/pkg"
	"google.golang.org/grpc"
	"net"
)

func main() {
	appconfig.Appconfig()
	initialize.InitNacos()
	initialize.InitConsul()
	initialize.InitRedis()
	initialize.InitMySQL()

	pkg.GoodsListEs()
	// 地址
	addr := "127.0.0.1:5005"
	// 1.监听
	listener, err := net.Listen("tcp", addr)
	if err != nil {
		fmt.Printf("监听异常:%s\n", err)
	}
	fmt.Printf("监听端口：%s\n", addr)
	// 2.实例化gRPC
	s := grpc.NewServer()
	// 3.在gRPC上注册微服务
	goods.RegisterGoodsServer(s, handel.NewGoodsSrvHandel())
	// 4.启动服务端
	s.Serve(listener)
}
